package org.jeecg.modules.demo.crm.service.impl;

import org.jeecg.modules.demo.crm.entity.CProjectMark;
import org.jeecg.modules.demo.crm.mapper.CProjectMarkMapper;
import org.jeecg.modules.demo.crm.service.ICProjectMarkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @Description: 项目数据标记
 * @Author: jeecg-boot
 * @Date:   2025-08-05
 * @Version: V1.0
 */
@Service
public class CProjectMarkServiceImpl extends ServiceImpl<CProjectMarkMapper, CProjectMark> implements ICProjectMarkService {

    @Autowired
    private CProjectMarkMapper cProjectMarkMapper;

    @Override
    public void edit(CProjectMark cProjectMark) {
        cProjectMark.setId(null);
        CProjectMark cProjectMark1 = cProjectMarkMapper.selectByProject(cProjectMark.getProjectId());
        if(cProjectMark1 != null){
            cProjectMark.setId(cProjectMark1.getId());
            cProjectMarkMapper.updateById(cProjectMark);
        }else {
            cProjectMarkMapper.insert(cProjectMark);
        }
    }
}
